<template>
    <div>
        <top-simple-search @searchFun="query" @addFun="handleAdd" @exportFun="toExport" :show-export="isAll">
            <el-form-item label="" prop="dept">
                <dept-select-tree v-model="formData.dept"  v-if="!isFaqi&&!isDraft" placeholder="请选择提交部门" style="width: 220px"  :appendToBody="true" zIndex="2100" :disable-branch-nodes="true"></dept-select-tree>
            </el-form-item>
            <el-form-item label="">
              <my-date-range :start-time.sync="formData.starttime" :end-time.sync="formData.endtime" :placeholder="['提交开始日期','提交结束日期']"></my-date-range>
            </el-form-item>
            <el-form-item label="">
                <el-select v-model="formData.is_draft" placeholder="请选择状态" clearable>
                    <el-option label="审批中" :value="0"></el-option>
                    <el-option label="未通过" :value="2"></el-option>
                    <el-option label="通过" :value="3"></el-option>
                </el-select>
            </el-form-item>
        </top-simple-search>
        <simple-table ref="myTable" :params="params" v-on="$listeners"  v-bind="$attrs">
            <el-table-column align="left" prop="title" label="标题" show-tooltip-when-overflow min-width="200">
                <template slot-scope="{row}">
                    <my-link @to="toView(row)">{{row.title}}</my-link>
                </template>
            </el-table-column>
            <el-table-column align="left" prop="alias" label="申请人" width="120">
            </el-table-column>
            <el-table-column align="left" prop="dept_name" label="部门" min-width="170">
            </el-table-column>
            <el-table-column align="left" prop="participant" label="当前办理人" min-width="160" v-if="isFaqi||isYiban||isAll" show-tooltip-when-overflow>
                <template slot-scope="{row}">
                    <span  v-if="row.participant">{{row.participant}}</span>
                    <span v-else-if="row.act_state_id==4">
                        已办结
                    </span>
                </template>
            </el-table-column>

            <el-table-column align="left" prop="is_draft" label="申请状态">
                <template slot-scope="{ row }">
                    <span v-if="row.is_draft == 0" class="yellowSpan">审批中</span>
                    <span v-if="row.is_draft == 1">草稿</span>
                    <span v-if="row.is_draft == 2" class="redSpan">未通过</span>
                    <span v-if="row.is_draft == 3" class="greenSpan">通过</span>
                </template>
            </el-table-column>
            <el-table-column align="left" prop="gmt_created" label="提交时间" width="170">
            </el-table-column>
            <el-table-column align="left" fixed="right" label="操作" width="150">
                <template slot-scope="{row}">
                    <edit-button v-if="(isDraft||row.is_edit&&isTodo)"  @click="toEdit(row)"></edit-button>
                    <my-button handle="chuli" v-else-if="isTodo" @click="toHandle(row)">处理</my-button>
                    <detail-button v-else @click="toView(row)"></detail-button>
                    <delete-button v-if="isDraft||isAll"  @click="toDelete(row.id)"></delete-button>
                    <my-button handle="print" @click="toPrint(row.id)" v-if="row.is_draft == 3">打印</my-button>
                    <my-button handle="cancel"  @click="toCancel(row)" v-if="isFaqi">取消</my-button>
                    <my-button handle="retreat"  @click="setTicketsRetreat(row)" v-if="isFaqi">撤回</my-button>
                </template>
            </el-table-column>
        </simple-table>
    </div>
</template>
<script>
    import MyLink from "../../components/MyLink/index";
    import ExtendTable from "@/mixins/ExtendTable";
    import DeptSelectTree from "@/components/Common/DeptSelectTree";
    import MyDateRange from "../../components/Common/MyDateRange";
    // 获取登录用户信息t
    export default {
        name: "ListTable",
        components: {MyDateRange, MyLink, DeptSelectTree},
        mixins: [ExtendTable],
        data() {
            return {
            }
        },
        created() {
        },
        computed: {
        },
        methods: {
        }
    }
</script>
